USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[Categories]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Categories](
	[CategoryId] [int] NULL,
	[CategoryName] [nvarchar](50) NULL,
	[Description] [nvarchar](500) NULL,
	[Status] [bit] NULL,
	[CreateDateTime] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[Languages]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Languages](
	[LanguageId] [int] NULL,
	[Language] [varchar](50) NULL,
	[Locale] [nchar](10) NULL,
	[TimeZone] [varchar](50) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MACategories]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MACategories](
	[CategoryId] [int] NULL,
	[CategoryName] [nvarchar](50) NULL,
	[Description] [nvarchar](500) NULL,
	[Status] [bit] NULL,
	[CreateDateTime] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MALanguages]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MALanguages](
	[LanguageId] [int] NULL,
	[Language] [varchar](50) NULL,
	[Locale] [nchar](10) NULL,
	[TimeZone] [varchar](50) NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MAMessages]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MAMessages](
	[MessageId] [bigint] NULL,
	[CategoryId] [int] NULL,
	[Message] [nvarchar](1000) NULL,
	[LanguageId] [int] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MAUserCategoryMapping]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MAUserCategoryMapping](
	[UserCategoryId] [bigint] NULL,
	[UserId] [bigint] NULL,
	[CategoryId] [int] NULL,
	[CreateDate] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MAUserMessageAudit]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[MAUserMessageAudit](
	[UserMessageId] [bigint] NULL,
	[UserId] [bigint] NULL,
	[MessageId] [bigint] NULL,
	[DateTime] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[MAUsers]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[MAUsers](
	[UserId] [bigint] NULL,
	[FirstName] [nvarchar](100) NULL,
	[LastName] [nvarchar](100) NULL,
	[Age] [int] NULL,
	[EmailId] [varchar](200) NULL,
	[Password] [nvarchar](50) NULL,
	[Mobile] [varchar](50) NULL,
	[DOB] [datetime] NULL,
	[CreateDateTime] [datetime] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[Messages]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Messages](
	[MessageId] [bigint] NULL,
	[CategoryId] [int] NULL,
	[Message] [nvarchar](1000) NULL,
	[LanguageId] [int] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[UserCategoryMapping]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[UserCategoryMapping](
	[UserCategoryId] [bigint] NULL,
	[UserId] [bigint] NULL,
	[CategoryId] [int] NULL,
	[CreateDate] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[UserMessageAudit]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[UserMessageAudit](
	[UserMessageId] [bigint] NULL,
	[UserId] [bigint] NULL,
	[MessageId] [bigint] NULL,
	[DateTime] [datetime] NULL
) ON [PRIMARY]

GO

USE [MobileAppDB]
GO

/****** Object:  Table [dbo].[Users]    Script Date: 02/13/2013 10:20:10 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [dbo].[Users](
	[UserId] [bigint] NULL,
	[FirstName] [nvarchar](100) NULL,
	[LastName] [nvarchar](100) NULL,
	[Age] [int] NULL,
	[EmailId] [varchar](200) NULL,
	[Password] [nvarchar](50) NULL,
	[Mobile] [varchar](50) NULL,
	[DOB] [date] NULL,
	[CreateDateTime] [datetime] NULL
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [dbo].[Users] ADD  CONSTRAINT [DF_Users_CreateDateTime]  DEFAULT (getdate()) FOR [CreateDateTime]
GO

